package com.aop.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassDescription: 测试接口，被拦截的请求
 * @JdkVersion: 1.8
 * @Author: 李白
 * @Created: 2024/12/29 14:55
 */
@RestController
@RequestMapping(value = "/aop")
public class AopTestController {

    @RequestMapping(value = "/test1")
    public JSONObject test(@RequestHeader("username")String username,
                           @RequestHeader("userGroup")String userGroup,
                           @RequestHeader("token")String token,
                           @RequestParam("age")String age,
                           @RequestParam("height")String height){

        JSONObject dataJson = new JSONObject();
        dataJson.put("username", username);
        dataJson.put("userGroup", userGroup);
        dataJson.put("token", token);
        dataJson.put("age", age);
        dataJson.put("height", height);

        JSONObject resultJson = new JSONObject();
        resultJson.put("code", 200);
        resultJson.put("msg", "请求成功");
        resultJson.put("data", dataJson);

        System.out.println("请求被调用---------------------》 "+resultJson);

        return resultJson;
    }

}
